package com.zr.gdms.serviceimpl;

import com.zr.gdms.dao.ScoreDao;
import com.zr.gdms.daoimpl.ScoreDaoImpl;
import com.zr.gdms.service.ScoreService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
 * 成绩服务层实现
 * @author 李培宁
 *
 */
public class ScoreServiceImpl implements ScoreService{

	ScoreDao sdao = new ScoreDaoImpl();
	@Override
	public JSONObject findScore(int page,int rows) {
		JSONObject jo = new JSONObject();
		jo.put("total", sdao.getScoreCount());
		jo.put("rows", sdao.getScores(page, rows));
		return jo;
	}
	@Override
	public JSONObject searchScore(int page, int rows, int score1, int score2) {
		JSONObject jo = new JSONObject();
		jo.put("total", sdao.getScoreCountByScore(score1, score2));
		jo.put("rows", sdao.searchScore(page, rows, score1, score2));
		return jo;
	}
	@Override
	public JSONObject searchScoreBySid(int page, int rows, int sid) {
		JSONObject jo = new JSONObject();
		jo.put("total", sdao.getScoreCountBySid(sid));
		jo.put("rows", sdao.searchScoreBySid(page, rows, sid));
		return jo;
	}
	@Override
	public JSONObject searchScoreBySname(int page, int rows,String sname) {
		JSONObject jo = new JSONObject();
		jo.put("total", sdao.getScoreCountBySname(sname));
		jo.put("rows", sdao.searchScoreBySname(page, rows, sname));
		return jo;
	}
	@Override
	public int totalStudentScore() {
		// TODO Auto-generated method stub
		return sdao.getScoreCount();
	}
	@Override
	public int totalStudentScoreBySid(int sid) {
		// TODO Auto-generated method stub
		return sdao.getScoreCountBySid(sid);
	}
	@Override
	public int totalStudentScoreBySname(String sname) {
		// TODO Auto-generated method stub
		return sdao.getScoreCountBySname(sname);
	}
	@Override
	public int totalStudentScoreByScore(int score1, int score2) {
		// TODO Auto-generated method stub
		return sdao.getScoreCountByScore(score1, score2);
	}

}
